/**
 * Copyright &copy; 2016-2022 liuhangjun All rights reserved.
 */
package com.channelsharing.hongqu.portal.api.service.impl;

import com.channelsharing.common.service.CrudServiceImpl;
import com.channelsharing.hongqu.portal.api.constant.Constant;
import com.channelsharing.hongqu.portal.api.dao.GroupBuyDetailDao;
import com.channelsharing.hongqu.portal.api.entity.GroupBuyDetail;
import com.channelsharing.hongqu.portal.api.service.GroupBuyDetailService;
import com.channelsharing.hongqu.portal.api.service.ProductInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 团购Service
 * @author liuhangjun
 * @version 2018-06-22
 */
@Service
public class GroupBuyDetailServiceImpl extends CrudServiceImpl<GroupBuyDetailDao, GroupBuyDetail> implements GroupBuyDetailService {

    @Autowired
    private ProductInfoService productInfoService;

    public static final String PORTAL_CACHE_PREFIX = Constant.PORTAL_CACHE_PREFIX;

    @Override
    public GroupBuyDetail findOne(Long id) {
        GroupBuyDetail groupBuyDetail = new GroupBuyDetail();
        groupBuyDetail.setId(id);
        return super.findOne(groupBuyDetail);
    }
//
//    @Override
//    public Paging<GroupBuyProduct> findPaging(@NonNull GroupBuyProduct entity) {
//        Paging<GroupBuyProduct> paging = super.findPaging(entity);
//        List<GroupBuyProduct> rows = paging.getRows();
//        if(!rows.isEmpty()){
//            rows.forEach(groupBuyProduct -> {
//                ProductInfo productInfo = productInfoService.findOne(groupBuyProduct.getProductId());
//                groupBuyProduct.setProductInfo(productInfo);
//            });
//        }
//
//        return paging;
//    }
}
